{extends file="../home.html"}
{block name="title"}{$head_title}{/block}
{block name="css"}
	<link rel="stylesheet" type="text/css" href="__PUBLIC__/Css/front/front_css/detail_page.css?version={$version}"/>
{/block}
{block name="content"}
	<div class="deliver-header">
		<div class="clearfix mui-action-back" onclick="return_last_page();">
			<i class="icon icon_back_default3x back-icon fl"></i>
			<span class="back-word fl go_back">返回</span>
		</div>
		<h1>评论</h1>
		<div class="deliver-btn">发布</div>
	</div>
	<div class="deliver-cont">
		<textarea name="" placeholder="快来发表自己的评论吧~" class="deliver-txt"></textarea>
	</div>
{/block}
{block name="js"}

	<script type="text/javascript" src="/Public/Js/front/front_js/ajaxupload.3.5.js"></script>
	<script type="text/javascript">
	var project_id = '{$project_id}'
	{literal}
		$(function(){
			$(".deliver-header i,.deliver-header span").on("touchstart",function(){
				history.go(-1);
			});
			$(".deliver-btn").on("click",function(){
				var contents = $(".deliver-txt").val();
				if(contents==""){
                    layer.open({
                        content: '请输入评论内容',
                        title: false,
                        btn: ['确定'],
                    });
                    return;
                }
                
                $.ajax({
                	url:'/FrontEnjoy/add_project_comment',
                	type:'post',
                	data:{project_id:project_id, contents:contents},
                	success:function(r){
                		if(r.code == 0){
                			layer.open({
		                        content: r.msg,
		                        title: false,
		                        btn: ['确定'],
								yes:function(){
		                        	if (!is_wechat()) {
										native_listen('back');
									} else {
										history.go(-1);
									}
//									history.go(-1);
								}
		                    });
							//history.go(-1);
                			//location.href = '/FrontEnjoy/project_details/project_id/'+project_id;
                		}else{
                			layer.open({
		                        content: r.msg,
		                        title: false,
		                        btn: ['确定'],
		                    });
                		}
                	}
                });
			});
		});
	{/literal}
	</script>

{/block}
